3.2.76 \(\int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx\) [176]

Optimal. Leaf size=180 \[ -\frac {c g (1-2 p) \, _2F_1\left (\frac {1}{2},\frac {1-p}{2};\frac {3-p}{2};\cos ^2(e+f x)\right ) (g \sec (e+f x))^{-1+p} \sin (e+f x)}{a f (1-p) \sqrt {\sin ^2(e+f x)}}+\frac {2 c \, _2F_1\left (\frac {1}{2},-\frac {p}{2};\frac {2-p}{2};\cos ^2(e+f x)\right ) (g \sec (e+f x))^p \sin (e+f x)}{a f \sqrt {\sin ^2(e+f x)}}-\frac {2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))} \]

[Out]

-c*g*(1-2*p)*hypergeom([1/2, 1/2-1/2*p],[3/2-1/2*p],cos(f*x+e)^2)*(g*sec(f*x+e))^(-1+p)*sin(f*x+e)/a/f/(1-p)/(
sin(f*x+e)^2)^(1/2)+2*c*hypergeom([1/2, -1/2*p],[1-1/2*p],cos(f*x+e)^2)*(g*sec(f*x+e))^p*sin(f*x+e)/a/f/(sin(f
*x+e)^2)^(1/2)-2*c*(g*sec(f*x+e))^p*tan(f*x+e)/f/(a+a*sec(f*x+e))

________________________________________________________________________________________

Rubi [A]
time = 0.16, antiderivative size = 180, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {4105, 3872, 3857, 2722} \begin {gather*} -\frac {c g (1-2 p) \sin (e+f x) (g \sec (e+f x))^{p-1} \, _2F_1\left (\frac {1}{2},\frac {1-p}{2};\frac {3-p}{2};\cos ^2(e+f x)\right )}{a f (1-p) \sqrt {\sin ^2(e+f x)}}+\frac {2 c \sin (e+f x) (g \sec (e+f x))^p \, _2F_1\left (\frac {1}{2},-\frac {p}{2};\frac {2-p}{2};\cos ^2(e+f x)\right )}{a f \sqrt {\sin ^2(e+f x)}}-\frac {2 c \tan (e+f x) (g \sec (e+f x))^p}{f (a \sec (e+f x)+a)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[((g*Sec[e + f*x])^p*(c - c*Sec[e + f*x]))/(a + a*Sec[e + f*x]),x]

[Out]

-((c*g*(1 - 2*p)*Hypergeometric2F1[1/2, (1 - p)/2, (3 - p)/2, Cos[e + f*x]^2]*(g*Sec[e + f*x])^(-1 + p)*Sin[e
+ f*x])/(a*f*(1 - p)*Sqrt[Sin[e + f*x]^2])) + (2*c*Hypergeometric2F1[1/2, -1/2*p, (2 - p)/2, Cos[e + f*x]^2]*(
g*Sec[e + f*x])^p*Sin[e + f*x])/(a*f*Sqrt[Sin[e + f*x]^2]) - (2*c*(g*Sec[e + f*x])^p*Tan[e + f*x])/(f*(a + a*S
ec[e + f*x]))

Rule 2722

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*((b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1
)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n
}, x] &&  !IntegerQ[2*n]

Rule 3857

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x])^(n - 1)*((Sin[c + d*x]/b)^(n - 1)
*Int[1/(Sin[c + d*x]/b)^n, x]), x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rule 3872

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Dist[a, Int[(d*
Csc[e + f*x])^n, x], x] + Dist[b/d, Int[(d*Csc[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, n}, x]

Rule 4105

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*
(B_.) + (A_)), x_Symbol] :> Simp[(-(A*b - a*B))*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e + f*x])^n/(b*f*(
2*m + 1))), x] - Dist[1/(a^2*(2*m + 1)), Int[(a + b*Csc[e + f*x])^(m + 1)*(d*Csc[e + f*x])^n*Simp[b*B*n - a*A*
(2*m + n + 1) + (A*b - a*B)*(m + n + 1)*Csc[e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, n}, x] && NeQ[
A*b - a*B, 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)] &&  !GtQ[n, 0]

Rubi steps

\begin {align*} \int \frac {(g \sec (e+f x))^p (c-c \sec (e+f x))}{a+a \sec (e+f x)} \, dx &=-\frac {2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))}+\frac {\int (g \sec (e+f x))^p (a c (1-2 p)+2 a c p \sec (e+f x)) \, dx}{a^2}\\ &=-\frac {2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))}+\frac {(c (1-2 p)) \int (g \sec (e+f x))^p \, dx}{a}+\frac {(2 c p) \int (g \sec (e+f x))^{1+p} \, dx}{a g}\\ &=-\frac {2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))}+\frac {\left (c (1-2 p) \left (\frac {\cos (e+f x)}{g}\right )^p (g \sec (e+f x))^p\right ) \int \left (\frac {\cos (e+f x)}{g}\right )^{-p} \, dx}{a}+\frac {\left (2 c p \left (\frac {\cos (e+f x)}{g}\right )^p (g \sec (e+f x))^p\right ) \int \left (\frac {\cos (e+f x)}{g}\right )^{-1-p} \, dx}{a g}\\ &=-\frac {c (1-2 p) \cos (e+f x) \, _2F_1\left (\frac {1}{2},\frac {1-p}{2};\frac {3-p}{2};\cos ^2(e+f x)\right ) (g \sec (e+f x))^p \sin (e+f x)}{a f (1-p) \sqrt {\sin ^2(e+f x)}}+\frac {2 c \, _2F_1\left (\frac {1}{2},-\frac {p}{2};\frac {2-p}{2};\cos ^2(e+f x)\right ) (g \sec (e+f x))^p \sin (e+f x)}{a f \sqrt {\sin ^2(e+f x)}}-\frac {2 c (g \sec (e+f x))^p \tan (e+f x)}{f (a+a \sec (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains higher order function than in optimal. Order 6 vs. order 5 in optimal.
time = 16.81, size = 3396, normalized size = 18.87 \begin {gather*} \text {Result too large to show} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

Integrate[((g*Sec[e + f*x])^p*(c - c*Sec[e + f*x]))/(a + a*Sec[e + f*x]),x]

[Out]

(-6*c*Sec[e + f*x]^p*(g*Sec[e + f*x])^p*Tan[(e + f*x)/2]^3*(-((AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2
, -Tan[(e + f*x)/2]^2]*Cos[(e + f*x)/2]^2)/(3*AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/
2]^2] + 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1
+ p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)) + AppellF1[1/2, p, -p, 3/2, Ta
n[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]/(3*AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] +
 2*p*(AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Ta
n[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)))/(a*f*(3*Sec[(e + f*x)/2]^2*Sec[e + f*x]^p*(-((Ap
pellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Cos[(e + f*x)/2]^2)/(3*AppellF1[1/2, p, 1
- p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]
^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e
 + f*x)/2]^2)) + AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]/(3*AppellF1[1/2, p, -p, 3/
2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*p*(AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e +
f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)) + 6*
p*Sec[e + f*x]^(1 + p)*Sin[e + f*x]*Tan[(e + f*x)/2]*(-((AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan
[(e + f*x)/2]^2]*Cos[(e + f*x)/2]^2)/(3*AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]
+ 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1 + p, 1
 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)) + AppellF1[1/2, p, -p, 3/2, Tan[(e +
 f*x)/2]^2, -Tan[(e + f*x)/2]^2]/(3*AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*p*(
AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e +
 f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)) + 6*Sec[e + f*x]^p*Tan[(e + f*x)/2]*((AppellF1[1/2, p,
1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Cos[(e + f*x)/2]*Sin[(e + f*x)/2])/(3*AppellF1[1/2, p, 1
- p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]
^2, -Tan[(e + f*x)/2]^2] + p*AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e
 + f*x)/2]^2) - (Cos[(e + f*x)/2]^2*(-1/3*((1 - p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e +
f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2]) + (p*AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan
[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3))/(3*AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2,
-Tan[(e + f*x)/2]^2] + 2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*A
ppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2) + ((p*AppellF1[3
/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3 + (p*Appell
F1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3)/(3*Ap
pellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*p*(AppellF1[3/2, p, 1 - p, 5/2, Tan[(e +
f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Tan[
(e + f*x)/2]^2) - (AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*(2*p*(AppellF1[3/2, p, 1
 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(
e + f*x)/2]^2])*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2] + 3*((p*AppellF1[3/2, p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -
Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3 + (p*AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]
^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/3) + 2*p*Tan[(e + f*x)/2]^2*((-3*(1 - p)*AppellF
1[5/2, p, 2 - p, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/5 + (6*p*A
ppellF1[5/2, 1 + p, 1 - p, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/
5 + (3*(1 + p)*AppellF1[5/2, 2 + p, -p, 7/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(
e + f*x)/2])/5)))/(3*AppellF1[1/2, p, -p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 2*p*(AppellF1[3/2, p
, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + AppellF1[3/2, 1 + p, -p, 5/2, Tan[(e + f*x)/2]^2, -Ta
n[(e + f*x)/2]^2])*Tan[(e + f*x)/2]^2)^2 + (AppellF1[1/2, p, 1 - p, 3/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]
^2]*Cos[(e + f*x)/2]^2*(2*((-1 + p)*AppellF1[3/2, p, 2 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + p*
AppellF1[3/2, 1 + p, 1 - p, 5/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2])*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2]
 + 3*(-1/3*((1 - p)*AppellF1[3/2, p, 2 - p, 5/2...

________________________________________________________________________________________

Maple [F]
time = 0.21, size = 0, normalized size = 0.00 \[\int \frac {\left (g \sec \left (f x +e \right )\right )^{p} \left (c -c \sec \left (f x +e \right )\right )}{a +a \sec \left (f x +e \right )}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x)

[Out]

int((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x, algorithm="maxima")

[Out]

-integrate((c*sec(f*x + e) - c)*(g*sec(f*x + e))^p/(a*sec(f*x + e) + a), x)

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x, algorithm="fricas")

[Out]

integral(-(c*sec(f*x + e) - c)*(g*sec(f*x + e))^p/(a*sec(f*x + e) + a), x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - \frac {c \left (\int \left (- \frac {\left (g \sec {\left (e + f x \right )}\right )^{p}}{\sec {\left (e + f x \right )} + 1}\right )\, dx + \int \frac {\left (g \sec {\left (e + f x \right )}\right )^{p} \sec {\left (e + f x \right )}}{\sec {\left (e + f x \right )} + 1}\, dx\right )}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*sec(f*x+e))**p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x)

[Out]

-c*(Integral(-(g*sec(e + f*x))**p/(sec(e + f*x) + 1), x) + Integral((g*sec(e + f*x))**p*sec(e + f*x)/(sec(e +
f*x) + 1), x))/a

________________________________________________________________________________________

Giac [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*sec(f*x+e))^p*(c-c*sec(f*x+e))/(a+a*sec(f*x+e)),x, algorithm="giac")

[Out]

Exception raised: TypeError >> An error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Unable to divide, perhaps due to rounding error%%%{-1,[0,1,2,0]%%%}+%%%{1,[0,1,0,0]%%%} / %%%{2,[0,0,0,1]%%
%} Error: B

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {\left (c-\frac {c}{\cos \left (e+f\,x\right )}\right )\,{\left (\frac {g}{\cos \left (e+f\,x\right )}\right )}^p}{a+\frac {a}{\cos \left (e+f\,x\right )}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((c - c/cos(e + f*x))*(g/cos(e + f*x))^p)/(a + a/cos(e + f*x)),x)

[Out]

int(((c - c/cos(e + f*x))*(g/cos(e + f*x))^p)/(a + a/cos(e + f*x)), x)

________________________________________________________________________________________